import 'package:flutter/material.dart';
import 'package:xindong/common/xindong_sezhi.dart';
import 'package:xindong/common/xindong_all.dart';
import 'package:xindong/widgets/common/xindong_common_widget.dart';

// 容器
class XinDongKongJianTitleContainer extends StatelessWidget {
  final String title;
  final String content;
  final List<Widget> children;
  final Function()? onTap; // 有值才显示更多按钮

  const XinDongKongJianTitleContainer(
      {super.key, required this.title, required this.children, this.content = "", this.onTap});

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: onTap,
      behavior: HitTestBehavior.opaque,
      child: Container(
        color: DZColors.cellColor,
        padding: const EdgeInsets.fromLTRB(15, 0, 15, 16),
        child: Column(
          mainAxisSize: MainAxisSize.min,
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            commonDivider(indent: 0, endIndent: 0),
            const SizedBox(height: 10.0),
            Row(
              children: [
                Expanded(child: Text(title, style: const TextStyle(fontSize: 15, fontWeight: FontWeight.w600))),
                Text(content, style: const TextStyle(fontSize: 13, fontWeight: FontWeight.w600)),
                    onTap == null ? const SizedBox(): XinDongAll.instance.defaultIconNext,
              ],
            ),
            const SizedBox(height: 10.0),
            ...children,
          ],
        ),
      ),
    );
  }
}
